<?php

class WrMemberPeer extends BaseWrMemberPeer
{
  public static function getMemberIdByName($name)
  {
    $c  = new Criteria();
    $c->add(WrMemberPeer::NAME, $name);
    $member = WrMemberPeer::doSelectOne($c);
    return $member->getId();
  }
  
  public static function getMembersByDay($day, $miss = 0)
  {
    $c = new Criteria();
    if ($day) {
      $c->add(WrBasicPeer::DATE1, $day);
    }
    $reports = WrBasicPeer::doSelect($c);
    
    $c = new Criteria();
    $list = array();
    foreach ($reports as $report) {
      $list[] = $report->getMemberId();
    }
    
    $c->add(WrMemberPeer::ID, $list, $miss ? Criteria::NOT_IN : Criteria::IN);
    $members = WrMemberPeer::doSelect($c);
    return $members;
  }
}
